package com.example.administrator.yuejian35.Login.model;

import com.example.administrator.yuejian35.Login.interf.LoginServer;

import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.example.administrator.yuejian35.Config.BASE_URL;

/**
 * Created by HP on 2017/10/7.
 */

public class LoginModel {
    private Retrofit retrofit;
    public LoginModel(){
        retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public Call reg(String username, String password, MultipartBody.Part file){
        LoginServer loginService = retrofit.create(LoginServer.class);
        return loginService.reg(username,password,file);
    }

    public Call DoLogin(String username, String password){
        LoginServer loginService = retrofit.create(LoginServer.class);
        return loginService.DoLogin(username,password);
    }
}
